package view

import (
	"html/template"
	"io"
	"gxgeek.com/gxgeek/learngo/crawler/frontend/model"
)

type SearchResultView struct {
	template *template.Template
}

func CreateSearchResultView(filename string) SearchResultView{
	return SearchResultView{
		template:template.Must(template.ParseFiles(filename)),
	}
}

func (s SearchResultView)Render(writer io.Writer,data model.SearchResult) error {
	return s.template.Execute(writer,data)
}
